<?php

Loader::using("ext::libs::restful::RESTfulClient");
Loader::using("Models::Entities::Response");

class Auth {

    private $usuario;
    private $password;

    function __construct($usuario, $password) {
        $this->usuario = $usuario;
        $this->password = $password;
    }

    public function getUsuario() {
        return $this->usuario;
    }

    public function setUsuario($usuario) {
        $this->usuario = $usuario;
    }

    public function getPassword() {
        return $this->password;
    }

    public function setPassword($password) {
        $this->password = $password;
    }

}

/**
 * Description of AutenticacionService
 *
 * @author JeyDotC
 */
class AutenticacionService extends RESTfulClient {

    public function Login($user, $pass) {
        $data = $this->getSerializer()->serialize(new Auth($user, md5($pass)));
        $result = $this->call("/", "POST", $data);
        ChromePhp::log("Data:", $data);
        ChromePhp::log("Result:", $result);
        return $this->getDeserializer()->deserialize("Response", $result);
    }

}

?>
